package com.infore.gateway.main.enums;

public enum ResultStatus {
    //操作成功
    SUCCESS(0, "SUCCESS"),
    //操作失败
    ERROR(1, "ERROR"),
    //这是示例，表示token错误，大部分请求直接返回0和1即可，如要添加其他类型请统一协商
    ERROR_TOKEN(2, "ERROR_TOKEN"),
    AUTH_FAILURE(3, "AUTH_FAILURE"),
    //用户接口无权限
    AUTH_URL_FAILURE(4, "AUTH_URL_FAILURE"),
    //请求成功
    OK(200, "OK"),
    //请求无效
    BAD_REQUEST(400, "Bad Request"),
    //未授权
    UNAUTHORIZED(401, "Unauthorized"),
    //禁止访问
    FORBIDDEN(403, "Forbidden"),
    //访问地址不存在
    NOT_FOUND(404, "Not Found"),
    //服务
    METHOD_NOT_ALLOWED(405, "Method Not Allowed"),
    INTERNAL_SERVER_ERROR(500, "Internal Server Error");

    private final int code;
    private final String reason;

    private ResultStatus(int statusCode, String reasonPhrase) {
        this.code = statusCode;
        this.reason = reasonPhrase;
    }

    public int getStatusCode() {
        return this.code;
    }

    public String getReasonPhrase() {
        return this.reason;
    }
}
